Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First attempt to support Next.js 13 appDir #83

Closed
wants to merge 4 commits into from

Conversation

SukkaW
Copy link
Contributor

@SukkaW SukkaW commented Dec 17, 2022

cc @TxHawks @Dwlad90

Would you like to try the patch to see if it works?

Note the appDir might still not work, but the current pages is not affected (the behavior is retained, thus it is fully backward compatible).

See also:

@SukkaW SukkaW force-pushed the next-13-appdir-1 branch 3 times, most recently from 479746e to a25f468 Compare December 17, 2022 02:11
@SukkaW
Copy link
Contributor Author

SukkaW commented Jan 14, 2023

After digging a little into Next.js and webpack-virtual-modules, it turns out that Next.js just doesn't work well with webpack-virtual-modules. And that's why it doesn't work on Next.js 13 appDir.

I have started another project style9-webpack, re-implements style9's webpack plugin without using webpack-virtual-modules.

@TxHawks @Dwlad90 would you like to give style9-webpack a shot?

@johanholmerin I am really willing to port my style9-webpack implementation back to style9, but:

  • I am unfamiliar with webpack inline loader syntax, so I am having trouble implementing the inlineLoader option of Style9Plugin.loader.
  • The virtualFileLoader approach used in style9-webpack is simple and has less overhead than webpack-virtual-modules, but it might be a little bit slower as virtualFileLoader does extra serialization.

@johanholmerin
Copy link
Owner

If your new plugin works better I'd be happy to integrate it. As for the inline loaders, it consists of the name of the loader, followed by an question mark and options, an exclamation mark, and then the normal path, e.g. loader-name?{options}!./file.css. Here's the best documentation I could find on it: https://webpack.js.org/concepts/loaders/#inline

@SukkaW
Copy link
Contributor Author

SukkaW commented Jan 14, 2023

If your new plugin works better I'd be happy to integrate it.

It does work for me.

As for the inline loaders, it consists of the name of the loader, followed by an question mark and options, an exclamation mark, and then the normal path, e.g. loader-name?{options}!./file.css. Here's the best documentation I could find on it: https://webpack.js.org/concepts/loaders/#inline

https://github.com/SukkaW/style9-webpack/blob/a069a46b14dcf3f8c4e20cf04ca851584199b6e8/src/loader.ts#L69-L74

image

Because I am not familiar with inline loader syntax, I don't know where to put inlineLoader (where css-loader and MiniExtractPlugin.loader would be). Is it right after !=! or is it after virtualResourceLoader?

@SukkaW SukkaW marked this pull request as draft January 14, 2023 16:05
@SukkaW
Copy link
Contributor Author

SukkaW commented Feb 4, 2023

I am closing this PR now, because:

I will continue doing some experiments in my style9-webpack repo, and then I will open other PRs to backport some of the features/optimizations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants